package br.com.felix.easyfileexplorer;

import javax.swing.Icon;
import javax.swing.ImageIcon;

/**
 * Enumerates the icons used in the EasyClearCaseExplorer
 * */
public enum EasyIcon {
	
	FOLDER("folder.png"),
	FILE("page_white.png"),
	COPY("page_copy.png"),
	PASTE("page_paste.png"),
	CUT("cut.png"),
	RENAME("page_white_edit.png"),
	DELETE("delete.png"),
	LEFT("arrow_left.png"),
	RIGHT("arrow_right.png"),
	REDO("arrow_redo.png"),
	ADD("add.png"),
	DRIVE("drive.png"),
	HIERARCHY("chart_organisation.png"),
	SEARCH("page_white_magnify.png");
	
	private Icon icon;

	private EasyIcon(String icon){
		this.icon = createImageIcon(icon, this.name());
	}
	
	private ImageIcon createImageIcon(String path, String description) {
		java.net.URL imgURL = ClassLoader.getSystemResource(path);
		if (imgURL != null) {
			return new ImageIcon(imgURL, description);
		}
		else {
			System.err.println("Couldn't find file: " + path);
			return null;
		}
	}
	
	public Icon icon(){
		return icon;
	}
}
